var md_alertPwd=(function($){
    var app={
        init:function(){
            var _this=this;
            $("#alert_form").validate(_this.alertPwdValid);
            $("#btn_alertPwd").on("click",function(){
                if ($("#alert_form").valid()){
                    md_common.postAjax("/admin/user/alertpwd",$("#alert_form").serialize(),function(result){
                        if(result.code=="0x0000x"){
                            md_common.showMessage("修改成功！")
                        }
                        else{
                            md_common.showMessage("对不起,密码不正确！");
                        }
                    });
                }
            });
        },
        alertPwdValid:{
            rules: {
                old_pwd: {
                    required: true,
                    maxlength:50
                },
                new_pwd: {
                    required: true,
                    maxlength:50
                },
                new_pwd1:{
                    required: true,
                    equalTo:"#new_pwd"
                }
            },
            messages: {
                old_pwd: {
                    required: "旧密码不能为空",
                    maxlength: "旧密码不能大于50个字符"
                },
                new_pwd: {
                    required: "密码不能为空",
                    maxlength: "密码不能大于50个字符"
                },
                new_pwd1:{
                    required: "确认密码不能为空",
                    equalTo: "新密码和确认密码不一致"
                }
            }
        }
    }
    return app;
})($);
if(typeof md_alertPwd!=undefined){
    $(function(){
        md_alertPwd.init();
    });
}
